Skip to content

Qualcomm AI Engine Direct - Debugger Converge Phase 1: Introduce debug handle#17804

Open
winskuo-quic wants to merge 1 commit intopytorch:mainfrom
CodeLinaro:dev1/winskuo/deubgger_converge_debug_handle
Open

Qualcomm AI Engine Direct - Debugger Converge Phase 1: Introduce debug handle#17804
winskuo-quic wants to merge 1 commit intopytorch:mainfrom
CodeLinaro:dev1/winskuo/deubgger_converge_debug_handle

Conversation

@winskuo-quic
Copy link
Collaborator

@winskuo-quic winskuo-quic commented Mar 3, 2026

Summary

We will be replacing part of the features in Qualcomm Intermediate Debugger with ExecuTorch's Debugger shortly.
This includes using Intermediate_Output_Capturer to capture CPU golden output and calculate_numeric_gap to perform tensor to tensor comparison.
To reuse these features, one key component is to enable debug_handle since ExecuTorch's tool saves per tensor result with mapping of {debug_handle : tensor_value}

This PR will be the 1st stage of debugger convergence, which is to enable debug_handle.

Test plan

python -m unittest executorch.backends.qualcomm.tests.test_passes.TestPasses.test_resolve_debug_handle

@winskuo-quic winskuo-quic requested a review from cccclai as a code owner March 3, 2026 05:23
@pytorch-bot
Copy link

pytorch-bot bot commented Mar 3, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/17804

Note: Links to docs will display an error until the docs builds have been completed.

❌ 3 New Failures

As of commit 7a91e7c with merge base f40bc56 (image):

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 3, 2026
@github-actions
Copy link

github-actions bot commented Mar 3, 2026

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@winskuo-quic
Copy link
Collaborator Author

Hi @Gasoonjia, @cccclai,
As discussed offline and in the email thread, we will start converging Qualcomm Intermediate Debugger with ExecuTorch's Debugger API.
We will break this feature down 2 to 3 PRs. This will be the first PR, focusing on enabling debug_handle for Qualcomm backend. I have added a unit test to ensure that the behavior is desired.
Please have a look. Thanks

@winskuo-quic winskuo-quic requested a review from Gasoonjia March 3, 2026 05:30
Copy link
Contributor

@Gasoonjia Gasoonjia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for your work!

"""
Caution: This pass is executed as the last of the edge_passes.
For any passes executed during qnn_preprocess, users will need to handle debug_handle ID themselves.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should add a comment here, highlighting that conditional branch like torch.cond is not supported right now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Gasoonjia,
Thanks for reviewing the PR.
I do have a comment below in line 31 for mentioning about conditional branch.
Do you think the comment looks good to you?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @winskuo-quic, it would be great to highlight that at the beginning of the class. User will first and sometimes only read the class-level comment and it will be great if we can warn them potential issue here.


# The second value in each tuple in `default_passes_and_setting` indicates whether the corresponding pass is activated by default.
# If a pass is activated, it will be executed by default.
default_passes_and_setting = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok so the order in this list will be the order applying the corresponding pass after to_edge right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the order is determined using the dependency table under backends/qualcomm/_passes/utils.py.
I made ResolveDebugHandle as the last executed pass in the dependency table. I have also added an assertion check under qnn_pass_manager.py to ensure this is the last pass for edge_transform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants